package service

func GenRedisWarn(redisWarn *[]map[string]interface{}, postWarning []map[string]interface{}) {
	for _, v := range postWarning {
		obj := make(map[string]interface{})
		obj["name"], _ = v["name"]
		obj["warning_mode"] = v["warningMode"]
		obj["warning_type"] = v["warningType"]
		obj["warning_ulimit"] = v["warningUlimit"]
		obj["warning_dlimit"] = v["warningDlimit"]
		obj["warning_level"] = v["warningLevel"]
		obj["warning_save"] = v["warningSave"]
		obj["alarmType"] = v["alarmType"]
		obj["isError"] = v["isError"]
		obj["warning_elimit"] = v["warningElimit"]
		obj["triggerType"] = v["triggerType"]
		if v, ok := v["autoDone"]; ok {
			obj["autoDone"] = v.(bool)
		} else {
			obj["autoDone"] = false
		}
		obj["uploadPeriod"] = v["uploadPeriod"]
		obj["collectPeriod"] = v["collectPeriod"]
		//告警愿意和建议
		obj["alarmReason"] = v["alarmReason"]
		obj["suggestion"] = v["suggestion"]
		*redisWarn = append(*redisWarn, obj)
	}
}
